package cn.hqhy.dish.service;

import cn.hqhy.dish.pojo.entity.Dish;
import cn.hqhy.dish.mapper.DishMapper;
import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.List;

@Service
public class DishService {

    @Autowired
    DishMapper dishMapper;

    public int insertDish(Dish dish) {
        return dishMapper.insert(dish);
    }//插入菜品


    public int updateDish(Dish dish) {
        return dishMapper.updateById(dish);
    }//修改菜品

    public int deleteDish(Integer id) {
        return dishMapper.deleteById(id);
    }//删除菜品

    public Dish getDishById(Integer id) {
        return dishMapper.getDishById(id);
    }//根据id查询菜品

    public List<Dish> getAllDishes() {
        return dishMapper.getAllDishes();
    }//查询所有菜品

    public Dish getDishByName(String dish_name) {
        return dishMapper.getDishByName(dish_name);
    }//根据名字查询菜品

    public List<Dish> getDishByCuisine(String dish_cuisine) {
        return dishMapper.getDishByCuisine(dish_cuisine);
    }//根据菜系查询菜品


    public List<Dish> getDishByTaste(String dish_taste) {
        return dishMapper.getDishByTaste(dish_taste);
    }//根据口味查询菜品

    public List<Dish> getDishByCategory(String dish_category) {
        return dishMapper.getDishByCategory(dish_category);
    }//根据荤素类别查询菜品

    public List<Dish> getDishByRating(Integer dish_rating) {
        return dishMapper.getDishByRating(dish_rating);
    }//根据推荐指数查询菜品

    public List<Dish> getDishByPriceRange(BigDecimal minPrice, BigDecimal maxPrice) {
        return dishMapper.getDishByPriceRange(minPrice, maxPrice);//根据价格区间查询菜品
    }

    public List<Dish> getDishByLikeName(String dish_name) {
        return dishMapper.getDishByLikeName(dish_name);//根据菜品名称模糊查询
    }

    public List<Dish> getDishByLikeTaste(String dishTaste) {
        return dishMapper.getDishByLikeTaste(dishTaste);//根据口味模糊查询
    }

    public List<Dish> getDishByRating2(int minRating) {
        return dishMapper.getDishByRating2(minRating);//根据指数区间查询
    }



}
